package com.example.capsule_chat0322.bean;

/**
 * @Author zhuzhiming
 * @Date 2022/5/15 22:44
 */
public class ChatRecordBean {

    private String field;
    private String roomName;
    private String senderId;
    private String senderName;
    private String content;
    private String sendTime;

    public String getRoomName() {
        return roomName;
    }

    public void setRoomName(String roomName) {
        this.roomName = roomName;
    }

    public String getSenderName() {
        return senderName;
    }

    public void setSenderName(String senderName) {
        this.senderName = senderName;
    }

    public String getSendTime() {
        return sendTime;
    }

    public void setSendTime(String sendTime) {
        this.sendTime = sendTime;
    }

    public String getField() {
        return field;
    }

    public void setField(String field) {
        this.field = field;
    }

    public String getSenderId() {
        return senderId;
    }

    public void setSenderId(String senderId) {
        this.senderId = senderId;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    @Override
    public String toString() {
        return "聊天室: " + roomName + "\n"
                + "ID: " + senderId + "\n"
                + "发送者: " + senderName + "\n"
                + "时间: " + (sendTime.contains(".") ? sendTime.substring(0, sendTime.lastIndexOf(".")) : sendTime) + "\n"
                + "内容: " + (content.length() > 20 ? content.substring(0, 21) + "..." : content);
    }
}
